﻿@using System.Web.Mvc.Ajax
@using System.Web.Mvc.Html
@using nanoCMS.Forum.WebUI.Models.ViewModels
@model ForumIndexVM

@{
    Layout = "~/Views/Shared/_Layout.cshtml"; 
}

@Html.ActionLink("Admin", "Index","ForumAdmin", null, new { @class = "modal" })

@foreach (var item in Model.RootList)
{
    <div style="border: 1px solid black; padding: 2px; margin: 2px;">
    @item.Title 
    @Html.ActionLink("Delete", "DeleteForum", "Forum", new { forumID = @item.ForumID }, null)
    @foreach (var subForum in item.SubForums)
    {
        <div style="margin: 2px 2px 2px 15px">@Html.ActionLink(subForum.Title, "Index", "Forum", 
            new { forumID = subForum.ForumID}, null)</div>   
        <div>post count: @subForum.PostsCount | thread count @subForum.ThreadsCount</div>
        <div>
            @Html.ActionLink("Edit", "Index", "ForumAdmin", new { forumID = @subForum.ForumID }, new { @class = "modal" })
            @Html.ActionLink("Delete", "DeleteForum", "Forum", new { forumID = @subForum.ForumID }, null)
        </div>
    }
    </div>
}


<script type="text/javascript">
    function ReoderCallback(result) {
        if (result == "ok") {
            window.location.reload();
        }
    }
</script>